
/*
 * @Descripttion:巡检管理接口API
 * @Author:
 * @version:
 */

import { requestUrl } from '@/common/util/request.ts';

// 计划列表
export function inspectionList(params: any = {}) {
	return requestUrl({
		url: `/insprecord/list/store-group`,
		data: params,
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}
// export function inspectionList(params: any = {}) {
// 	return requestUrl({
// 		url: `/insprecord/list/recently`,
// 		data: params,
// 		method: 'get',
// 		keyWord: 'inspection',
// 		isJson: false
// 	})
// }
//计划详情
export function inspectionListDetail(inspPlanId:string,inspStoreId:string) {
	return requestUrl({
		url: `/insprecord/store-dtl/${inspPlanId}/${inspStoreId}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}
// export function inspectionListDetail(param:string) {
// 	return requestUrl({
// 		url: `/inspectionplan/${param}`,
// 		data: '',
// 		method: 'get',
// 		keyWord: 'inspection',
// 		isJson: false
// 	})
// }
// 巡检明细列表
export function detailList(params: any = {}) {
	return requestUrl({
		url: `/insprecord/list`,
		data: params,
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 获取枚举
export function getAllEnum(enumkeys: string) {
	return requestUrl({
		url: `/enums/${enumkeys}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 门店下拉
export function getStoreList(params: any = {}) {
	return requestUrl({
		url: `/scmstore/list`,
		data: params,
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 巡检计划详情
export function planInfo(inspRecordId: any) {
	return requestUrl({
		url: `/insprecord/store-content-dtl/base-record/${inspRecordId}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 巡检结果上报
export function report(par: any) {
	return requestUrl({
		url: `/insprecord/report`,
		data: par,
		method: 'put',
		keyWord: 'inspection',
		isJson: true
	})
}

// 提交巡检结果
export function subRes(params: any) {
	return requestUrl({
		url: `/insprecord/dtl`,
		data: params,
		method: 'put',
		keyWord: 'inspection',
		isJson: true
	})
}

// 某次巡检记录主要信息
export function getMainInfo(params: any) {
	return requestUrl({
		url: `/insprecord/main-info/${params}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 门店某次巡检所有点位记录列表
export function getPoss(params: any) {
	return requestUrl({
		url: `/insprecord/positions/${params}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 点位下内容明细记录列表
export function contentDtls(inspRecordId,inspPositionId,queryType) {
	return requestUrl({
		url: `/insprecord/position/content-dtls/${inspRecordId}/${inspPositionId}/${queryType}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 点位整改提交
export function rectifySub(params:any) {
	return requestUrl({
		url: `/insprectifylist/rectify/position`,
		data: params,
		method: 'put',
		keyWord: 'inspection',
		isJson: true
	})
}

// 上报整改
export function rectifyRep(params:any) {
	return requestUrl({
		url: `/insprectifylist/rectify/report`,
		data: params,
		method: 'put',
		keyWord: 'inspection',
		isJson: true
	})
}

// 查询计划巡检点位是否存在 
export function checkInspectDW(inspPlanId,inspPositionNo) {
	return requestUrl({
		url: `/inspectionplan/approved/${inspPlanId}/${inspPositionNo}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}

// 查询门店编码是否合法
export function checkStoreNum(storeCode:string) {
	return requestUrl({
		url: `/scmstore/approved/${storeCode}`,
		data: '',
		method: 'get',
		keyWord: 'inspection',
		isJson: false
	})
}


